import axios from 'axios'
import { ElMessage } from 'element-plus'
//创建axios实例
const request = axios.create({
    //服务器地址
    baseURL: '/apispace',
    timeout: 5000,
})
//请求拦截器
request.interceptors.request.use((config) => {

    return config
})
//响应拦截器
request.interceptors.response.use(
    (response) => {
        return response.data
    },
    (error) => {
        ElMessage({
            type: 'error',
            message: "请求失败",
        })
        return Promise.reject(error)
    },
)
export default request